class Solution(object):
    def rotate(self, nums, k):
        """
        :type nums: List[int]
        :type k: int
        :rtype: None Do not return anything, modify nums in-place instead.
        """
        n = len(nums)
        k = k % n
        if k == 0:
            return
        #　不能够写nums这会生成新的数组,而写nums[:]会指向原数组
        nums[:] = nums[-k:] + nums[:-k]



nums = [1,2,3,4,5,6,7]
k = 3
print(Solution().rotate(nums, k))

# [1,2,3]

# [3,1,2]
# [2,3,1]
#[